/*
 *
 *      Copyright (c) 2018-2025, cloud All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the pig4cloud.com developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: cloud
 *
 */

package com.fuyao.cloud.admin.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuyao.cloud.admin.api.dto.MenuSearchDTO;
import com.fuyao.cloud.admin.api.dto.SysMenuDTO;
import com.fuyao.cloud.admin.api.dto.SysRoleMenuDTO;
import com.fuyao.cloud.admin.api.entity.SysMenu;
import com.fuyao.cloud.admin.api.vo.MenuVo;
import com.fuyao.cloud.common.data.datascope.CloudBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.poi.ss.formula.functions.T;

import java.util.List;

/**
 * <p>
 * 菜单权限表 Mapper 接口
 * </p>
 *
 * @author cloud
 * @since 2017-10-29
 */
@Mapper
public interface SysMenuMapper extends CloudBaseMapper<SysMenu> {

	/**
	 * 通过角色编号查询菜单
	 * @param roleId 角色ID
	 * @return
	 */
	List<SysMenu> listMenusByRoleId(Long roleId);

	/**
	 * 通过角色ID查询权限
	 * @param roleIds Ids
	 * @return
	 */
	List<String> listPermissionsByRoleIds(String roleIds);

	/**
	 * 根据菜单path查询菜单数据权限
	 * @param searchDTO 查询条件对象
	 * @return 菜单集合
	 */
    List<MenuVo> findMenuVOList(@Param("search") MenuSearchDTO searchDTO);

    /**
	 * 根据菜单path查询菜单数据权限
	 * @param menuDTO 角色菜单查询条件
	 * @return 菜单集合
	 */
    List<MenuVo> findMenuDataScopeList(@Param("search") SysRoleMenuDTO menuDTO);

	/**
	 * 菜单角色分页 方法
	 * @param page
	 * @param menuDTO
	 * @return
	 */
    IPage getMenuRolePage(Page page, @Param("search") SysRoleMenuDTO menuDTO);
}
